﻿using System;
using System.Collections.Generic;
using System.Text;

using E.Model;
using E.DAL;

namespace E.BLL
{
    public class NoticeBLL
    {
        private NoticeDAL dal;

        public NoticeBLL()
        {
            dal = new NoticeDAL();
        }

        /// <summary>
        /// 获取通告类别列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetNoticeCategoryList()
        {
            return dal.GetNoticeCategoryList();
        }

        /// <summary>
        /// 获取普通通告列表
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public NoticeListModel GetNormalNoticeListByCondition(SearchNoticeModel searchModel, int pageSize, int pageIndex)
        {
            searchModel.SysSelection = 0;
            return GetNoticeListByCondition(searchModel, pageSize, pageIndex);
        }

        /// <summary>
        /// 获取系统通告列表
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public NoticeListModel GetSysNoticeListByCondition(SearchNoticeModel searchModel, int pageSize, int pageIndex)
        {
            searchModel.SysSelection = 1;
            return GetNoticeListByCondition(searchModel, pageSize, pageIndex);
        }

        /// <summary>
        /// 获取通告列表
        /// </summary>
        /// <param name="searchModel"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public NoticeListModel GetNoticeListByCondition(SearchNoticeModel searchModel, int pageSize, int pageIndex)
        {
            return dal.GetNoticeListByCondition(searchModel, pageSize, pageIndex);
        }

        /// <summary>
        /// 获取公告信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public NoticeModel GetNoticeInfo(int id)
        {
            return dal.GetNoticeInfo(id);
        }

        /// <summary>
        /// 获取公告地区ID列表
        /// </summary>
        /// <param name="noticeid"></param>
        /// <returns></returns>
        public IList<int> GetNoticeAreaIDList(int noticeid)
        {
            return dal.GetNoticeAreaIDList(noticeid);
        }

        /// <summary>
        /// 添加公告
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddNotice(NoticeModel model)
        {
            return dal.AddNotice(model);
        }

        /// <summary>
        /// 更新公告
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateNotice(NoticeModel model)
        {
            return dal.UpdateNotice(model);
        }

        /// <summary>
        /// 删除公告
        /// </summary>
        /// <param name="noticeid"></param>
        /// <returns></returns>
        public int DelNotice(string[] noticeid)
        {
            return dal.DelNotice(noticeid);
        }
    }
}
